<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<!--<link th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>-->
<body class="gray-bg">
<!--	<div class="ui-layout-west">
		<div class="main-content">
			<div class="box box-main">
				<div class="box-header">
					<div class="box-title">
						<i class="fa icon-grid"></i> 组织机构
					</div>
					<div class="box-tools pull-right">
						&lt;!&ndash;<a type="button" class="btn btn-box-tool menuItem" href="#" onclick="dept()" title="管理部门"><i class="fa fa-edit"></i></a>&ndash;&gt;
						<button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>
						<button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>
						<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新"><i class="fa fa-refresh"></i></button>
					</div>
				</div>
				<div class="ui-layout-content">
					<div id="tree" class="ztree"></div>
				</div>
			</div>
		</div>
	</div>-->
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								专业：<select id="majorId" name="majorId" type="text" style="padding: 0px">
								<option value="">全部</option>
								<option th:each="obj,eStat:${major}" th:value="${obj.majorId}"
										th:text="${obj.majorName}"></option>
							</select>
							</li>

							<li>
								班级：<input type="text" name="className"/>
							</li>

							<li style="width: 100%;text-align: center">
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.addFull()" shiro:hasPermission="teach:teachExam:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.editFull()" shiro:hasPermission="teach:teachExam:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="teach:teachExam:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="teach:teachExam:export">
						<i class="fa fa-download"></i> 导出
				 </a>-->
				<br/>
				<span style="color: #cb4042">考试合格：(>=及格线)/班级基数</span>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true" ></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
	<!--<script th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
	<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>-->
    <script th:inline="javascript">
        var detailFlag = [[${@permission.hasPermi('teach:teachExam:detail')}]];
        var editFlag = [[${@permission.hasPermi('teach:teachExam:edit')}]];
        var removeFlag = [[${@permission.hasPermi('teach:teachExam:remove')}]];
        var prefix = ctx + "teach/teachExam";

        $(function() {
            /*var panehHidden = false;
            if ($(this).width() < 769) {
                panehHidden = true;
            }
            $('body').layout({ initClosed: panehHidden, west__size: 185 });*/
            queryList();
            /*queryDeptTree();*/
        });

        function queryList() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                detailUrl: prefix + "/detail/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "班级考试",
				search: false,
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'examId', 
					title : '考试id',
					visible: false
				},
                    {
                        field : 'schoolName',
                        title : '校区',
                        sortable: false,
                        formatter:paramsMatter

                    },
                    {
                        field : 'majorName',
                        title : '专业',
                        sortable: false,
                        formatter:paramsMatter

                    },
                    {
                        field : 'className',
                        title : '班级',
                        sortable: false
                    },
                    {
                        field : 'stageName',
                        title : '阶段',
                        sortable: false
                    },
				{
					field : 'datetime', 
					title : '考试时间',
					sortable: false,
                    formatter:paramsMatter

                },
				{
					field : 'cutOffscores', 
					title : '及格线',
					sortable: false
				},
				{
					field : 'teacherName',
					title : '监考老师',
					sortable: false
				},
				{
					field : 'address', 
					title : '考试地点',
					sortable: false,
                    formatter:paramsMatter

                },
                    {
                        field : 'pass',
                        title : '考试通过人数',
                        sortable: false
                    },
                    {
                        field : 'fail',
                        title : '考试未通过人数',
                        sortable: false
                    },
                    {
                        field : 'studentNum',
                        title : '班级在读人数',
                        sortable: false
                    },
                    {
                        field : 'acceptability',
                        title : '考试及格率',
                        sortable: false
                    },
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a style="color:#ffffff;display: inline-block;padding:0px 2px;background-color: #0e9aef;" class=" ' + editFlag + '" href="#" onclick="$.operate.editFull(\'' + row.examId + '\')">编辑</a> ');
                        actions.push('<a style="color:#ffffff;display: inline-block;padding:0px 2px;background-color: rgb(242,178,89)" class="' + detailFlag + '" href="#" onclick="$.operate.detail(\'' + row.examId + '\')">详情</a> ');
		            	actions.push('<a style="color:#ffffff;display: inline-block;padding:0px 2px;background-color: red;" class="' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.examId + '\')">删除</a>');
                        return $.table.dropdownToggle(actions.join(''));
		            }
		        }]
            };
            function paramsMatter(value,row,index) {
                var span=document.createElement('span');
                span.setAttribute('title',value);
                span.innerHTML = value;
                span.style.width="80px";
                span.style.display="inline-block";
                span.style.overflow="hidden";
                span.style.textOverflow="ellipsis";
                span.style.whiteSpace="nowrap";
                return span.outerHTML;
            }
            $.table.init(options);
        }

       /* function queryDeptTree()
        {
            var url = ctx + "system/dept/treeData";
            var options = {
                url: url,
                expandLevel: 2,
                onClick : zOnClick
            };
            $.tree.init(options);

            function zOnClick(event, treeId, treeNode) {
                $("#schoolId").val(treeNode.id);
                $("#parentId").val(treeNode.pId);
                $.ajax({
                    type:"POST",
                    url:prefix + '/listById',
                    data:{schoolId:treeNode.id},
                    success : function(data) {
                        /!*alert("成功");
                        console.log(data);*!/
                        $("#bootstrap-table").bootstrapTable('load', data);
                    }
                })
            }
        }

        $('#btnExpand').click(function() {
            $._tree.expandAll(true);
            $(this).hide();
            $('#btnCollapse').show();
        });

        $('#btnCollapse').click(function() {
            $._tree.expandAll(false);
            $(this).hide();
            $('#btnExpand').show();
        });

        $('#btnRefresh').click(function() {
            queryDeptTree();
        });

        /!* 学生管理-部门 *!/
        function dept() {
            var url = ctx + "system/dept";
            createMenuItem(url, "部门管理");
        }*/
    </script>
</body>
</html>